From 727b7014d8058972aa4426e8ed43438ea12aed6b Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Thu, 30 Mar 2006 12:41:48 -0700 Subject: [PATCH] [IA64] Fix domain reboot bug Actually domain reboot issue is not caused by our previous patch to solve schedule_tail, which instead helps to find a severe HOST_SMP plus domain destroy bug. The major reason is that currently VHPT table for dom0/domU is per LP, while domain destroy only issues vhpt_flush on current LP (dom0 is running). So VHPT table is not flushed on the LP that destroyed domU is running. The mechanism of domain reboot is to kill current domain and create a new domain with same configuration. Since region id recycle is added last time with domain destroy support, the new created domain will inherit same region id as previous one. Under this case, the stale entries in VHPT table will make new domU halt. Before applying our schedule_tail patch, domU will keep same pta value as idle domain when first created where vhpt walker is disabled. Because we use bvt as default scheduler, context switch never happens as long as domU is runnable. That means domU will have vhpt DISABLED in whole life cycle. So even vhpt on that LP is not flushed, domU still runs correctly. So we need to send IPI to target LP to flush right vhpt table. Especially, based on our previous patch for schedule_tail, domU can get performance gain by enabling vhpt walker. Signed-off-by: Zhang xiantao Signed-off-by: Kevin Tian --- xen/arch/ia64/linux-xen/smp.c | 6 ++++++ xen/arch/ia64/xen/domain.c | 2 +- xen/arch/ia64/xen/vhpt.c | 2 +- xen/include/asm-ia64/vhpt.h | 6 ++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/xen/arch/ia64/linux-xen/smp.c b/xen/arch/ia64/linux-xen/smp.c index fb84bb5b82..953b930644 100644 --- a/xen/arch/ia64/linux-xen/smp.c +++ b/xen/arch/ia64/linux-xen/smp.c @@ -47,6 +47,7 @@ #include #include #include +#include #ifdef XEN #include #endif @@ -290,6 +291,11 @@ smp_flush_tlb_all (void) { on_each_cpu((void (*)(void *))local_flush_tlb_all, NULL, 1, 1); } +void +smp_vhpt_flush_all(void) +{ + on_each_cpu((void (*)(void *))vhpt_flush, NULL, 1, 1); +} #ifndef XEN void diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index fd2a5692e8..c4926421f3 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -106,7 +106,7 @@ void arch_domain_destroy(struct domain *d) flush_tlb_all(); /* It is really good in this? */ - vhpt_flush(); + vhpt_flush_all(); } static void default_idle(void) diff --git a/xen/arch/ia64/xen/vhpt.c b/xen/arch/ia64/xen/vhpt.c index c6cadae6a9..b6ef0a04d9 100644 --- a/xen/arch/ia64/xen/vhpt.c +++ b/xen/arch/ia64/xen/vhpt.c @@ -20,7 +20,7 @@ DEFINE_PER_CPU (unsigned long, vhpt_pend); void vhpt_flush(void) { - struct vhpt_lf_entry *v = (void *)VHPT_ADDR; + struct vhpt_lf_entry *v =__va(__ia64_per_cpu_var(vhpt_paddr)); int i; #if 0 static int firsttime = 2; diff --git a/xen/include/asm-ia64/vhpt.h b/xen/include/asm-ia64/vhpt.h index 465065b351..d0a31c49fa 100644 --- a/xen/include/asm-ia64/vhpt.h +++ b/xen/include/asm-ia64/vhpt.h @@ -16,6 +16,12 @@ #define VHPT_PAGE_SHIFT VHPT_SIZE_LOG2 + +#ifdef CONFIG_SMP +# define vhpt_flush_all() smp_vhpt_flush_all() +#else +# define vhpt_flush_all() vhpt_flush() +#endif // FIXME: These should be automatically generated #define VLE_PGFLAGS_OFFSET 0 -- 2.30.2